<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 200px;">
                <input type="text" name="card_num" id="card_num" lay-verify="title" placeholder="Card Num" autocomplete="off"
                       class="layui-input" value="{$card_num}">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="search_card"><i class="iconfont icon-chaxun"></i>Search</button>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <span>cycleAmountLimitAvailable: <span style="font-size: 18px;color: red" id="card_balance_span">{$api_amount}</span></span>;
            <span>cycleAmountLimit: <span style="font-size: 18px;color: red">{$api_amount_total}</span></span>;
            <span>cycleAmountLimitHold: <span style="font-size: 18px;color: red">{$amount_hold}</span></span>;
            <span>cycleAmountLimitUsed: <span style="font-size: 18px;color: red" id="card_used_span">{$amount_used}</span></span>;
            <br/><br/>
            <span>卡号: <span style="font-size: 20px;color: green" id="card_num_span">{$card_num}</span></span>;
            <span>卡状态: <span style="font-size: 20px;color: green">{$card_status}</span></span>;
            <span style="padding-left: 50px;"><button class="layui-btn layui-btn-sm" lay-submit lay-filter="del_card">delCard</button></span>;
        </div>
    </div>
</form>
<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var table   = layui.table;
        var tableIn = layui.table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            toolbar: '#toolbar', //开启头部工具栏，并为其绑定左侧模板
            defaultToolbar: ['filter', 'exports'],
            url: "{:url('toolbar/cardDelList')}",
            id: 'balanceTable',
            cols: [[
                { type: 'numbers'},
                { field: 'card_num', title: 'CardNum',align:"left",totalRowText:'Total：'},
                {field: 'card_balance', title: '删除前卡余额($)', align:"right",
                    style:'color:#FF5722;font-weight:bold' , totalRow: true},
                { field: 'card_used', title: '删除前卡已用金额($)', align:"right",
                    style:'color:#FF5722;font-weight:bold', totalRow: true},
                { field: 'ctime', align: 'center', title: 'create time' ,
                    templet: function (d) {
                        return layui.util.toDateString(d.ctime * 1000, "yyyy-MM-dd HH:mm:ss");
                    }
                }
            ]],
            page: true,
            limit: 20,
            limits: [20 , 100 , 500 ]
        });
        layui.form.on('submit(search_card)', function () {
            var loading =layer.load(1, {shade: [0.1,'#fff']});
            JsGet('{:url("toolbar/cardDelList")}', {card_num:$("#card_num").val()},function (re) {
                layer.close(loading);
                if(re.code >0){
                    layer.msg(re.msg , {icon:1,time:1500});
                }else{
                    layer.msg(re.msg, {icon:2,time:1500});
                }
            });
        });
        layui.form.on('submit(del_card)', function () {
            var loading =layer.load(1, {shade: [0.1,'#fff']});
            JsPost('{:url("toolbar/delCard")}', {
                card_num:$("#card_num_span").html(),
                card_balance:$("#card_balance_span").html(),
                card_used:$("#card_used_span").html(),
            },function (re) {
                layer.close(loading);
                if(re.code >0){
                    layer.msg(re.msg , {icon:1,time:1500});
                    location.href= "{:url('cards/cardDelList')}";
                }else{
                    layer.msg(re.msg, {icon:2,time:1500});
                }
            });
        });

    });
</script>